User Guide > Tasks > Working with Cloud Connected Mobile > Adding Validation to Method Routes

Adding Validation to Method Routes

This procedure describes how to add validation to a Zend Server Gateway RPC or RESTful API method.

 

 

Instructions on how to complete a procedure

To add Validation to existing methods:

  1. In the PHP Explorer, open the 'config' folder of your CCM server-side project, and select the 'gateway.xml 'file .
    The file is displayed in a graphic editor.

  1. From the Handlers list on the right, drag the Validation element and drop it in the center of the editor.
    The Add Validation dialog is displayed.

  1. Select which request parameter you wish to create a validation rule for, and click Add Route/Query/Body Parameter.
    The dialog displays configuration options for a new validation field.

  1. Configure the new validation parameter:
  • Select or enter a name for the parameter.
  • To add a validator, click Add Validator, and then select a validator from the drop-down menu.
  • To add a validation filter, click Add Filter, and select a filter from the drop-down menu.
  • To remove a validator, click Remove.
  1. Click OK.
    The validation parameter is added to the method route and displayed in the editor.

Test the validation in the Test Service view, by running a test on a parameter with an invalid value. You should receive a '400 Invalid parameter(s) in request' response, with an error message describing was wrong with the request.

To remove the validation, hover over it in the editor and click -OR- right-click, and select Delete.

 

 

Related Links

Related Links:

Cloud Connected Mobile

Configuring the Zend Server Gateway

Adding and Testing Authentication

Adding and Testing Authentication

Procedural Configuration

Test Service View

 

 

 

©1999-2013 Zend Technologies LTD. All rights reserved.